package Builder;

import java.util.ArrayList;
import java.util.List;


// 餐品类逻辑上 是需要 burger & drink
public class Meal {

    private List<Items> itemsList = new ArrayList<Items>(); //

    String strList = "";

    public void add(Items item){  // 这里的item是 Interface 类型的 接口类型
        itemsList.add(item);
    }

    public float getTotalPrice(){
        float cost = 0.0f;

        for (Items item :
                itemsList) {
            cost += item.price();
        }

        return cost;
    }

    public String showItemsList(){
        for (Items item :
                itemsList) {
            strList += "Item: " + item.name() + "Packing: " + item.packing().pack() + " Price: " + item.price();
        }

        return strList;
    }

}
